package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Customer;
import cn.wolfcode.mapper.CustomerMapper;
import cn.wolfcode.mapper.CustomerReportMapper;
import cn.wolfcode.result.QueryObject;
import cn.wolfcode.service.ICustomerReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description: 报表查询业务层实现类
 * @Author: 伍家钰
 * @Date: 2020/7/23 12:53
 * @Version: 1.0
 */
@Service
public class CustomerReportServiceImpl implements ICustomerReportService {
    @Autowired
    private CustomerReportMapper customerReportMapper;

    @Override
    public PageInfo query(QueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(), qo.getPageSize());
        List<HashMap> customers = customerReportMapper.selectForList(qo);
        return new PageInfo<>(customers);
    }

    @Override
    public List<HashMap> selectAll(QueryObject qo) {
        List<HashMap> customerReports = customerReportMapper.selectAll(qo);
        return customerReports;
    }
}
